]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Split enabled setting from enabled state
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 9 Oct 2017 10:51:08 +0000 (12:51 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 16 Jan 2018 16:41:46 +0000 (17:41 +0100)
We enable the keyboard when it is either enabled explicitly via
a11y settings or when using a touch device. We'll soon want to
special-case changes to the GSettings, so track its value in a
dedicated property.

https://bugzilla.gnome.org/show_bug.cgi?id=788188

js/ui/keyboard.js

index 87635ce83e321521bd344106afab3fc00ca31ddd..771f23dc249899b8b0fe1e8be2400a95122f6dff 100644 (file)
@@ -168,6 +168,9 @@ var Keyboard = new Lang.Class({
         this._caretTrackingEnabled = false;
         this._updateCaretPositionId = 0;
 
+        this._enableKeyboard = false; // a11y settings value
+        this._enabled = false; // enabled state (by setting or device type)
+
         this._keyboardSettings = new Gio.Settings({ schema_id: KEYBOARD_SCHEMA });
         this._keyboardSettings.connect('changed', Lang.bind(this, this._sync));
         this._a11yApplicationsSettings = new Gio.Settings({ schema_id: A11Y_APPLICATIONS_SCHEMA });
@@ -305,14 +308,14 @@ var Keyboard = new Lang.Class({
     },
 
     _syncEnabled: function () {
-        this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD) ||
-                               this._lastDeviceIsTouchscreen();
-        if (!this._enableKeyboard && !this._keyboard)
+        this._enableKeyboard = this._a11yApplicationsSettings.get_boolean(SHOW_KEYBOARD);
+        this._enabled = this._enableKeyboard || this._lastDeviceIsTouchscreen();
+        if (!this._enabled && !this._keyboard)
             return;
 
-        this._setCaretTrackerEnabled(this._enableKeyboard);
+        this._setCaretTrackerEnabled(this._enabled);
 
-        if (this._enableKeyboard) {
+        if (this._enabled) {
             if (!this._keyboard)
                 this._setupKeyboard();
             else
@@ -509,7 +512,7 @@ var Keyboard = new Lang.Class({
     },
 
     _redraw: function () {
-        if (!this._enableKeyboard)
+        if (!this._enabled)
             return;
 
         let monitor = Main.layoutManager.keyboardMonitor;
@@ -614,7 +617,7 @@ var Keyboard = new Lang.Class({
     },
 
     show: function (monitor) {
-        if (!this._enableKeyboard)
+        if (!this._enabled)
             return;
 
         this._clearShowIdle();
@@ -650,7 +653,7 @@ var Keyboard = new Lang.Class({
     },
 
     hide: function () {
-        if (!this._enableKeyboard)
+        if (!this._enabled)
             return;
 
         this._clearShowIdle();
@@ -713,14 +716,14 @@ var Keyboard = new Lang.Class({
     },
 
     setCursorLocation: function(x, y, w, h) {
-        if (!this._enableKeyboard)
+        if (!this._enabled)
             return;
 
 //        this._setLocation(x, y);
     },
 
     setEntryLocation: function(x, y, w, h) {
-        if (!this._enableKeyboard)
+        if (!this._enabled)
             return;
 
 //        this._setLocation(x, y);